package com.tobeface.wechat.request.api;

import com.google.common.collect.ImmutableMap;
import com.tobeface.modules.lang.Requires;
import com.tobeface.wechat.request.AbstractWeChatApiRequestBuilder;
import com.tobeface.wechat.request.WeChatRequest;

/**
 * @author loudyn
 */
public class CreateGroupApiRequestBuilder extends AbstractWeChatApiRequestBuilder {

    private String name;

    /**
     *
     */
    public CreateGroupApiRequestBuilder() {
        super("https://api.weixin.qq.com/cgi-bin/groups/create", WeChatRequest.Verb.POST);
    }

    /**
     * @param name
     * @return
     */
    public CreateGroupApiRequestBuilder name(String name) {
        Requires.hasText(name);
        this.name = name;
        return this;
    }

    @Override
    protected void configRequest(WeChatRequest request) {
        request.entity(ImmutableMap.of("group", ImmutableMap.of("name", name)));
    }
}
